/*
 * @Copyright: Copyright (C) AMCAX, All rights reserved.
 * @Author: 殷建峰
 * @Date: 2025-02-10 14:25:03
 * @LastEditTime: 2025-03-02 11:14:38
 * @LastEditors: 殷建峰
 * @Description:
 */
import { cmdImport } from '@/commands/standard';
import { useCommandManager } from '@amcax/base';
import { ImportOutlined } from '@ant-design/icons';
import { Dropdown, MenuProps, Space } from 'antd';
import { VscChevronDown } from 'react-icons/vsc';
import styles from './styles.module.scss';

const items: MenuProps['items'] = [
  {
    key: 'import_file',
    label: '导入',
    icon: <ImportOutlined />,
    /*  children: [
      {
        key: '',
        label: '导入',
      },
    ],*/
  },
];

export const FileMenu = () => {
  const { invokeCmd } = useCommandManager();
  const onClick: MenuProps['onClick'] = async ({ key }) => {
    if (key === 'import_file') {
      // 导入命令
      invokeCmd(cmdImport);
      return;
    }
  };
  return (
    <Dropdown
      menu={{ items, onClick }}
      trigger={['click']}>
      <a onClick={(e) => e.preventDefault()}>
        <Space className={styles['file-menu']}>
          文件
          <VscChevronDown />
        </Space>
      </a>
    </Dropdown>
  );
};
